package com.itheima.homework;

public class Homework {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    }

    public static void firstHomework(){
        int[] arr = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        for(int i = 0;i < arr.length;i++){
            System.out.print(arr[i] + " ");
        }
    }

    public static void secondHomework(){
        int[] arr = new int[]{100,50,90,60,80,70};
        int sum = 0;
        for(int i : arr){
            System.out.print(i + " ");
        }
        System.out.println("\n" + sum);
    }

    public static void thirdHomework(){
        int[] arr = {100,50,90,60,80,70};
        int minnum = arr[0];
        for (int i = 1;i < arr.length;i++){
            if(arr[i] < minnum){
                minnum = arr[i];
            }
        }
        System.out.println(minnum);
    }

    public static void fourthHomework(){
        int[] arr = {100,50,90,60,80,70};
        int maxnum = arr[0];
        for (int i = 1;i < arr.length;i++){
            if(maxnum < arr[i]){
                maxnum = arr[i];
            }
        }
        System.out.println(maxnum);
    }

    public static void fifthHomework(){
        int[] arr = {100,50,90,60,80,70};
        int sum = 0;
        int maxnum = arr[0];
        int minnum = arr[0];
        for (int i = 1;i < arr.length;i++){
            if(maxnum < arr[i]){
                maxnum = arr[i];
            }
            if(minnum > arr[i]){
                minnum = arr[i];
            }
            sum += arr[i];
        }
        System.out.println((sum - maxnum - minnum) / (arr.length - 2));
    }
}
